In [71]:
import matplotlib.pyplot as plt
import numpy as np
import plotly
import plotly.express as px
import seaborn as sns
import random
plotly.offline.init_notebook_mode()

Matplot library¶

Using Matplot library to implement 3D bar plots¶

In [72]:
fig = plt.figure()
ax = plt.axes(projection="3d")

num_bars = 10
x_pos = random.sample(range(15), num_bars)
y_pos = random.sample(range(15), num_bars)
z_pos = [0] * num_bars
x_size = np.ones(num_bars)
y_size = np.ones(num_bars)
z_size = random.sample(range(15), num_bars)

ax.bar3d(x_pos, y_pos, z_pos, x_size, y_size, z_size, color='#427DFF')
plt.show()

Seaborn library¶

Using seaborn library to depict random data¶

In [73]:
sns.set()
rng = np.random.RandomState(0)
x = np.linspace(0, 10, 500)
y = np.cumsum(rng.randn(500, 6), 0)

plt.plot(x, y)
plt.legend('ABCDEF', ncol=2, loc='upper left');

Ployly library¶

Using plotly to display scatter plot¶

In [74]:
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                 size='petal_length', hover_data=['petal_width'])
fig.show()

Matplotlb library¶

Line chart using Matplotlb library¶

In [75]:
a = [1, 2, 3, 4, 5]
b = [0, 0.6, 0.2, 15, 10, 8, 16, 21]
plt.plot(a)

plt.plot(b, "or")
  
plt.plot(list(range(0, 22, 3)))
  
plt.xlabel('Day ->')
  
plt.ylabel('Temp ->')
  
c = [4, 2, 6, 8, 3, 20, 13, 15]
plt.plot(c, label = '4th Rep')
  
ax = plt.gca()
  
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
  
ax.legend(['1st Rep', '2nd Rep', '3rd Rep', '4th Rep'])

plt.annotate('Temperature V / s Days', xy = (1.01, -2.15))

plt.title('All Features Discussed')
  
plt.show()